(1) In your project screen, first select the AUDIO clip (that you wish to control) & then 'duplicate' it. (You now have two identical audio clips in a row)
(2) Now select the SECOND AUDIO CLIP & open its 'controls'
(3) Slide in 'IN' marker to where your audio should change volume (NOTE: this is the ACTUAL start point of the audio dissolve!) & close its window when done
From this point on everything is automated by ARexx, there are no numbers to remember, start times to add together etc.
(4) Run this ARexx routine (with the second audio clip still highlighted)
The Arexx routine will ask you for the volume level for the second clip, and for the length of the transition time for the level change.
That's it - you're all done. You can even start over by duplicating the second clip & begin your next 'volume change'.
Notes...
This routine never alters the IN points of any clips, so that is where you have control to simply move an IN and re-run this routine again to move your fade point.
The out point of the final audio crouton has the real ending of the set of clips. The out point of the first clip is set by this routine to to overlap into the second crouton.
This routine is designed to work with one audio clip that gets duplicated. It will NOT cross fade between two different clips, and it will NOT skip out sections of the audio clip. It is designed (for safety) to adjust levels at pre-set points for one continuously running audio clip only.
You might also notice that the louder clips are set with your requested fade time, but the softer clips are set with shorter fade times - this is to eliminate any hollow spots in the fade & to establish the soft level quickly beneath the fading loud level. You can go in afterwards & change these fade lengths manually to go for a different effect.
*/
call remlib('PROJECT_REXX_PORT')
call addlib('PROJECT_REXX_PORT',0)
/* --- begin --- */
OK=1
NotOK=0
highvol=0
AudioNext=NotOK
AudioPrev=NotOK
start_loc=croutonspot()
if start_loc>0 then do
/* --- Check previous audio clip --- */
call croutonpick(start_loc-1)
if croutontype()=" AUD" then do
AudioPrev=OK
prevaudioname=croutonname()
prevIN=croutongettag(AudioStart)
prevOUT=prevIN+croutongettag(AudioDuration)
prevstart=croutongettag(Delay)
Last_Time_Mode= croutongettag(TimeMode) /* Locking to 2=prog time 1=inpoint 0=clip */
prevrecfields=croutongettag(recfields)
vol1P=croutongettag(AUDIOVOLUME1)
vol2P=croutongettag(AUDIOVOLUME2)
end
/* --- Read Selected (next) audio clip --- */
call croutonpick(start_loc)
if croutontype()=" AUD" then do
AudioNext=OK
audioname=croutonname()
Cut1=croutongettag(AudioStart)
Duration=croutongettag(AudioDuration)
Cut2=Duration+Cut1
vol1N=croutongettag(AUDIOVOLUME1)
vol2N=croutongettag(AUDIOVOLUME2)
end
/* --- wait for any screen update delay --- */
call time('R')
do while (time('E')<0.5)
end
end
call req_open("1-XVols - by Aussie","----------------","Sets a volume change & fade into the SELECTED audio clip","and out of the PREVIOUS IDENTICAL audio clip.")
/* --- Kick out if both are not audio clips --- */
if AudioNext~=OK | AudioPrev~=OK then do
test=req_tell("Sorry, CANCELED!"," Both the selected & previous clips","must be AUDIO ONLY clips! Help?")
call req_close()
if test=1 then call quithelp
call quit()
end
/* --------- check for matching name */
if audioname ~= prevaudioname then do
test=req_tell("Sorry, CANCELED!"," The 2 AUDIO clips MUST be"," from the identical file. Help?")
call req_close()
if test=1 then call quithelp
call quit()
end
/* --- Calculate Volumes --- */
vol1=((vol1N/655.35)+0.5)%1
if vol1<0 then vol1=0
if vol1>100 then vol1=100
vol2=((vol2N/655.35)+0.5)%1
if vol2<0 then vol2=0
if vol2>100 then vol2=100
if vol1>highvol then highvol=vol1
if vol2>highvol then highvol=vol2
highvolprev=0
/* ------------- get audio levels */
vol1prev=((vol1P/655.35)+0.5)%1
if vol1prev<0 then vol1prev=0
if vol1prev>100 then vol1prev=100
vol2prev=((vol2P/655.35)+0.5)%1
if vol2prev<0 then vol2prev=0
if vol2prev>100 then vol2prev=100
if vol1prev>highvolprev then highvolprev=vol1prev
if vol2prev>highvolprev then highvolprev=vol2prev
/* ---------- compare in & out points to avoid ridiculous problems */
if (prevIN>=Cut1) then do
test=req_tell("Sorry, CANCELED!","The 2nd clip's IN point must be"," higher than the first. Help?")
call req_close()
if test=1 then call quithelp
call quit()
end
/* ------------ get volumes & fade speed */
volume=req_number("Prev clip:" highvolprev " This vol:",highvol,0,100)
if volume="CANCEL" then do
call req_close()
call quitb()
end
f_fadetime=60
f_want=req_time("Set fade length:",f_fadetime)
if substr(f_want,3,1)~= ":" then do
call req_close()
call quitb()
end
fm=substr(f_want,4,2)
fs=substr(f_want,7,2)
ff=substr(f_want,10,2)
f_all=((fm*1800)+(fs*30)+ff)*2
fadetime=f_all
/* ----------- make all settings */
newprevduration=cut1-prevIN+fadetime
newnextstart=prevstart+cut1-prevIN
fadetimeprev=fadetime
fadetimenext=fadetime
if volume>highvolprev then fadetimeprev=fadetime/2
if volume<highvolprev then fadetimenext=fadetime/2
if (newprevduration+prevIN)>prevrecfields then do
test=req_tell("Sorry, CANCELED!"," 1st clip runs out before"," this fade is complete. Help?")
call req_close()
if test=1 then call quithelp
call quit()
end
if duration<(fadetimenext) then do
test=req_tell("Sorry, CANCELED!"," 2nd clip OUT point too close"," to complete this fade. Help?")
call req_close()
if test=1 then call quithelp
call quit()
end
/* ----------------- Proceed or not */
test=req_tell("Ok to create this volume change","Volume change:" highvolprev "to" volume, "Fade length: " f_want)
call req_close()
if test~=OK then call quitb()
/* --- Write to clips --- */
call croutonpick(start_loc-1)
call croutonsettag(AudioDuration,newprevduration)
call croutonsettag(AudioDecay,fadetimeprev)
call croutonsettag(panelmode,1)
/* ----------------- */
call croutonpick(start_loc)
call croutonsettag(AudioAttack,fadetimenext)
call croutonsettag(Delay,NewNextStart)
call croutonsettag(panelmode,1)
call croutonsettag(TimeMode,Last_Time_Mode) /* Locking to 2=prog time 1=inpoint 0=clip */
if volume~= highvol then do
vol1=volume
vol1=vol1*655.35
call croutonsettag(AUDIOVOLUME1,vol1)
vol2=volume
vol2=vol2*655.35
call croutonsettag(AUDIOVOLUME2,vol2)
end
quita:
/* --- Wrap Up --- */
call projectupdate()
call croutonpick(start_loc)
call req_error(" OZ: All Done! Audio now crossfades a volume change")
call remlib("PROJECT_REXX_PORT")
exit
quitb:
test=req_tell("CANCELED!"," Do you want help?"," ")
if test=1 then call quithelp
quit:
call croutonpick(start_loc)
call req_error(" OZ: <<< Last Operation Canceled >>>")
call remlib("PROJECT_REXX_PORT")
exit
/* --------------------- help stuff to explain it all */
quithelp:
test=req_tell("Here is help","1-Pick AUDIO clip, then DUPLICATE","2-Pick second clip & open controls")
if test~=OK then call quit()
test=req_tell("More help...","3-Set IN to mark fade start","4-Close window & run this program")
if test~=OK then call quit()
test=req_tell("Last help...","It will reset points, change the","volume & set the fades. Bye.")